<?php

class Db_Column {
	const COLUMN_PROPERTY_NAME = "name";
	const COLUMN_PROPERTY_TYPE = "type";
	const COLUMN_PROPERTY_LENGTH = "length";
	const COLUMN_PROPERTY_PRIMARY = "primary";
	const COLUMN_PROPERTY_AUTOINCREMENT = "autoincrement";
	const COLUMN_PROPERTY_MINLENGTH = "minlength";
	const COLUMN_PROPERTY_UNIQUE = "unique";
	const COLUMN_PROPERTY_NOTNULL = "notnull";
	const COLUMN_PROPERTY_DEFAULT = "default";

	const COLUMN_TYPES_INT = "int";
	const COLUMN_TYPES_VARCHAR = "varchar";

	public $name = "";
	public $type = "";
	public $length = "";
	public $primary = false;
	public $autoincrement = false;
	public $minlength = 0;
	public $unique = false;
	public $notnull = false;
	public $value = null;

	public function __construct ($name, $type = "varchar", $length = "250", array $data = array()) {
		$this->name = $name;
		$this->type = $type;
		$this->length = $length;

		foreach ($data as $k => $v)
			$this->$k = $v;
	}
	
}